﻿var gis = {
	
	centerPoint: [ 108.372564, 22.823606 ],
	
	map: null,
		
	init : function() {
		gis.map = gis.createMap();
		//gis.getEnterpriseData();
		gis.eventBind();
	},
	
	eventBind : function() {
		//search
		SearchController.initial();
		SearchController.onClick();
		//cancel
		SearchController.onCancelIconClick();
		//item
		ItemController.onItemChange();
		//condition
		ConditionController.initial();
		AdvancedController.initial();
		GasWaterTypeController.initial();
		YearController.initial();
		AirController.initial();
		permitActualController.initial();
	},
	
	
	createMap: function() {
		var map = new AMap.Map('container', {
			resizeEnable : true,
			zoom : 8,
			center : gis.centerPoint
		});
		return map;
	},
	
	clearMap: function() {
		gis.map.clearMap();
	},
	
	createMarker: function(data){
	    var marker = new AMap.Marker({
	        map: gis.map,
			position: data.position,
	        icon: new AMap.Icon({            
	            size: new AMap.Size(60, 60),  //图标大小
	            image: "http://webapi.amap.com/theme/v1.3/images/newpc/way_btn2.png",
	            imageOffset: new AMap.Pixel(0, -60)
	        })        
	    });
	}
};

$(function(){
	function createmap() {
		var oSize = getPageSize();
		var sWidth = oSize.WindowWidth;
		var sHeight = oSize.WindowHeight;
		$('.n-main').css('height',sHeight);
	}
	createmap(); 
	$(window).resize(function () {
		createmap();
	});
	
	gis.init();
	
	Service.areaService.getAreas();
	Service.tradeService.getTrades();
	Service.controlLevelService.getControleLevels();
	Service.polluteService.getPollutes();
	Service.processTechService.getProcessTech();
	Service.timeService.getYears();
	
	ECard.renderTab();
	PCard.renderTab();
	//PDCard.renderTab();
});